import React from 'react'
import Header from '../components/Header';
import axios from 'axios';
import { message } from 'antd';
import './Designcontent.css'
const Designcontent = (props) => {
    let dcontent = props.location.state.dcontent;
    let user = props.location.state.user
    const api = `http://192.168.72.166:8080/api/postInspirationAttentionDatas/?user_inspiration_id=${user.user_id}&user_id=${dcontent.user_id}&design_id=${dcontent.design_id}`
    console.log(props)
    const changeValue = () => {
        const btn = document.getElementsByClassName('dbtn')[0];
        btn.value = '已关注'
    }
    return (
        <div>
            <Header />
            <div className='design_content'>
                <div className='design_name'>
                    <h3>{dcontent.design_name}</h3>
                </div>
                <div className='dcontent'>
                    <div className='dcontent_left'>
                        <img src={dcontent.design_image} />
                    </div>
                    <div className='dcontent_right'>
                        <div className='somecontent'>
                            <div className='design_user_content'>
                                <img src={dcontent.user_head_portrait} />
                                <span>{dcontent.user_name}</span>
                            </div>
                            <form method='post' action={api}>
                                <input type='submit' className='dbtn' value='关注' onClick={() => changeValue()} />
                            </form>
                            <div className='introduction'>
                                <span>作品简介:</span>
                                <p>{dcontent.design_content}</p>
                            </div>
                        </div>


                    </div>
                </div>
            </div>
        </div>
    )
}

export default Designcontent;